//
// Created by dell on 2025/3/3.
//字节对齐
#include <cstdio>
#pragma pack(push,1)
struct AlignedStruct {
    char a;      // 1 字节
    int b;       // 4 字节
    short c;     // 2 字节
    bool d;//1
};
#pragma pack(pop)
struct UnalignedStruct {
    char a;      // 1 字节
    short c;     // 2 字节
    bool d;//1 自己
    int b;       // 4 字节
};

int main() {
    printf("Size of AlignedStruct: %zu\n", sizeof(struct AlignedStruct));
    printf("Size of UnalignedStruct: %zu\n", sizeof(struct UnalignedStruct));
    return 0;
}
